dojo.provide("uws.drawing.usecase.UseCase");
dojo.require('uws.drawing.Component');

dojo.declare('uws.drawing.usecase.UseCase',uws.drawing.Component,{
	constructor: function(surface,id,dx,dy, sortOrder,usecase,fromDS){
		this.center_x = 160;
		this.center_y = 55;
		this.label = usecase;
		this.sortOrder = sortOrder;
		
		if(fromDS){
			dx+=this.center_x;
			dy+=this.center_y;
		}
		
		//connector top
		this.top_con=this.connectors_shape_group.createCircle({
			cx:160,
			cy:25,
			r:3
		}).setStroke("white").setFill("white");
		
		//connector bottom
		this.bottom_con=this.connectors_shape_group.createCircle({
			cx:160,
			cy:85,
			r:3
		}).setStroke("white").setFill("white");
		
		//connector left
		this.left_con=this.connectors_shape_group.createCircle({
			cx:80,
			cy:55,
			r:3
		}).setStroke("white").setFill("white");
		
		//connector right
		this.right_con=this.connectors_shape_group.createCircle({
			cx:240,
			cy:55,
			r:3
		}).setStroke("white").setFill("white");
		
		this.actual_shape_group.createEllipse({
			cx:160,
			cy:55,
			rx:80,
			ry:30
		}).setStroke("black").setFill("white");
		
		this.label_shape = this.actual_shape_group.createText({
			text:usecase,
			x:this.center_x,
			y:(this.center_y+8),
			align:"middle"
		}).setFill("black").setFont(defaultFont);
		
		this._postCreate(dx, dy);
	},
	setUseCase:function(usecase){
		this.label = usecase;
		this.label_shape.setShape({
			text:usecase,
			x:this.center_x,
			y:(this.center_y+8),
			align:"middle"
		}).setFill("black").setFont(defaultFont);
	},
	applyProperties:function(properties){
		this.label = properties.label;
		this.description = properties.label;
		this.label_shape.setShape({
			text: this.label,
			x:this.center_x,
			y:(this.center_y+8),
			align:"middle"
		}).setFill("black").setFont(defaultFont);
	}
});